<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    #box{
        width: 200px;
        height: 200px;
        background-color: aqua;
    }
</style>
<body>
    <p>属性名：<input type="text" value="sxm" id="qqq"></p>
    <p>属性值：<input type="text" value="sxz" id="www"></p>
    <button onclick="add()">确定</button><button onclick="del()">重置</button>
    <div id="box">qwert</div>
</body>
<script>
        var qqq=document.getElementById('qqq')
        var www=document.getElementById('www')
        var box=document.getElementById('box')
    function add(){
        var key=qqq.value;
        var value=www.value
        box.style[key]=value
        console.log(key,value);
    }
    function del(){
        box.style={}
    }
</script>
</html>